package org.iblink.core.domain.dao;

import java.util.List;

import org.iblink.core.domain.model.Category;

/**
 * This interface grants access to categories in the database.
 * 
 * @author tpares
 *
 */
public interface CategoryDao {
  /**
   * <p>Loads a category</p>
   * @param id the category ID
   * @return the category
   */
  Category getCategory(long id);
  
  /**
   * <p>Loads all categories</p>
   * @return the list of all categories
   */
  List<Category> getCategories();
  
  /**
   * <p>Saves or updates a category</p>
   * @param category the category to save or update
   */
  void saveCategory(Category category);
  
  /**
   * <p>Deletes a category</p>
   * @param id the ID of the category to delete
   */
  void deleteCategory(long id);
  
  /**
   * <p>Loads sub-categories of a category</p>
   * @param id the ID of the category to load the sub categories from
   * @return the list of the <code>category</code>'s sub-categories
   */
  List<Category> getSubCategories(long id);
  
  /**
   * <p>Returns root categories</p>
   * @return the root categories
   */
  List<Category> getRoots();
}
